/*
 * @Author: shawnXiao
 * @Date: 2022-01-04 16:41:09
 * @LastEditTime: 2022-01-05 10:06:19
 * @FilePath: /vite2-vue3-typescript/src/i18n/index.ts
 */
import { createI18n } from 'vue-i18n'
import store from '@/store'
import en from './language/en'
import zh from './language/zh'

const messages = {
  en,
  zh,
}

const locale = store.getters['app/language'] || 'zh'

const i18n = createI18n({
  // 使用 Composition API 模式，则需要将其设置为false
  legacy: false,
  // 全局注入 $t 函数
  globalInjection: true,
  locale,
  messages,
})

export default i18n
